package ModelLayer;
import java.util.ArrayList;

/**
 * Write a description of class LendCollection here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class LendCollection
{
    // instance variables - replace the example below with your own
    private ArrayList<Lend> l;

    /**
     * Constructor for objects of class LendCollection
     */
    public LendCollection()
    {

    }

    /**
     * this method adds a lend to the collection
     */
    public void addLend(Lend l)
    {
        this.l.add(l);
    }

    /**
     * this method removes a lend from the collection
     * @param i
     */
    public void removeLend(Lend l)
    {
        this.l.remove(l);
    }

    /**
     * this methods makes it possible to search in the collection
     * @param id
     */
    public Lend findLend(int ID)
    {
        int index = 0;
        while(l.size() > index)
        {
            Lend lends = l.get(index);
            if(lends.getID()==(ID))
            {
                return lends;
            }
            index++;
        }
        return null;
    }

}
